<?php include template('header','common');?>
<link rel="stylesheet" type="text/css" href="{__ROOT__}template/default/statics/css/student-pinglun.css?v={HD_VERSION}">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
<div class="container">
	<div class="content">
		<div class="list">
			<div class="item">
				<img src="{$teacher1['avatar']}" alt="">
				<div class="item-right">
					<span>{$teacher1['truename']}</span>
					<select id="example-fontawesome" name="rating">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
					</select>
					<input type="hidden" name="mealNum" value="{$teacher1['mealNum']}">
					<input type="hidden" name="teacher_id" value="{$teacher1['id']}">
					<input type="hidden" name="student_id" value="{$student_id}">
				</div>
			</div>
			<div class="item-bottom" style="padding-left:5px;">您的评分会让老师变得更好~</div>
		</div>
		<div class="tishi">
			<img src="{__ROOT__}template/default/statics/img/ti-shi-.png" alt="">
			<span>一周可评分一次</span>
		</div>
	</div>
    {if $point == 0}
	<div class="btn-view">
		<button class="btn scoring">提交</button>
	</div>
    {/if}
</div>
<script src="{__ROOT__}template/default/statics/js/jquery.barrating.js"></script>
<script>
	$(".scoring").click(function(){
		var teacher_id = $("[name='teacher_id']").val();
		var student_id = $("[name='student_id']").val();
		var mealNum = $("[name='mealNum']").val();
		var _this = $(this);
		var ajaxurl="<?php echo url('member/point/ajaxscoring')?>";
		$.post(ajaxurl,{'teacher_id':teacher_id,'student_id':student_id,'mealNum':mealNum},function(ret){
			if(ret.status == 1){
				alerts(ret.message);
			}else{
				alerts(ret.message);
			}
		},'json');
	});
    $(function() {
        function ratingEnable() {    
            $('#example-fontawesome').barrating({
                theme: 'fontawesome-stars',
				initialRating:{$teacher1['mealNum']},
                showSelectedRating: false,
				onSelect:function(value, text){
					$("[name='mealNum']").val(value);
				}
            });        
        }
        ratingEnable();
    });
</script>
<?php include template('footer','common');?>